<?php

/**
 * SqlServer class interface.
 * Due to PHP 5.3.x version, mssql.dll does not work anymore.
 * @link http://be2.php.net/manual/en/book.sqlsrv.php
 */
interface ISqlServer {
  /**
   * Access to predefined constant specifying the type of array to return.
   * Used to get an associative array from the call to fetchArray().
   *
   * @final
   * @link http://be2.php.net/manual/en/function.sqlsrv-fetch-array.php
   */
  const FetchAssociative = SQLSRV_FETCH_ASSOC;

  /**
   * Access to predefined constant specifying the type of array to return.
   * Used to get an indexed array from the call to fetchArray().
   *
   * @final
   * @link http://be2.php.net/manual/en/function.sqlsrv-fetch-array.php
   */
  const FetchNumeric = SQLSRV_FETCH_NUMERIC;

  /**
   * Access to predefined constant specifying the type of array to return.
   * Used to get an associative and indexed array from the call to fetchArray().
   *
   * @final
   * @link http://be2.php.net/manual/en/function.sqlsrv-fetch-array.php
   */
  const FetchBoth = SQLSRV_FETCH_BOTH;

  /**
   * Access in a result set that uses a scrollable cursor.
   * A fetch type of ISqlServer::FetchAssociative value should not be used when consuming a result set with multiple columns of the same name.
   *
   * @final
   * @see http://be2.php.net/manual/en/function.sqlsrv-fetch-array.php
   */
  const ScrollNext = SQLSRV_SCROLL_NEXT;

  /**
   * Access in a result set that uses a scrollable cursor.
   * A fetch type of ISqlServer::FetchAssociative value should not be used when consuming a result set with multiple columns of the same name.
   *
   * @final
   * @see http://be2.php.net/manual/en/function.sqlsrv-fetch-array.php
   */
  const ScrollPrior = SQLSRV_SCROLL_PRIOR;

  /**
   * Access in a result set that uses a scrollable cursor.
   * A fetch type of ISqlServer::FetchAssociative value should not be used when consuming a result set with multiple columns of the same name.
   *
   * @final
   * @see http://be2.php.net/manual/en/function.sqlsrv-fetch-array.php
   */
  const ScrollFirst = SQLSRV_SCROLL_FIRST;

  /**
   * Access in a result set that uses a scrollable cursor.
   * A fetch type of ISqlServer::FetchAssociative value should not be used when consuming a result set with multiple columns of the same name.
   *
   * @final
   * @see http://be2.php.net/manual/en/function.sqlsrv-fetch-array.php
   */
  const ScrollLast = SQLSRV_SCROLL_LAST;

  /**
   * Access in a result set that uses a scrollable cursor.
   * A fetch type of ISqlServer::FetchAssociative value should not be used when consuming a result set with multiple columns of the same name.
   *
   * @final
   * @see http://be2.php.net/manual/en/function.sqlsrv-fetch-array.php
   */
  const ScrollAbsolute = SQLSRV_SCROLL_ABSOLUTE;

  /**
   * Access in a result set that uses a scrollable cursor.
   * A fetch type of ISqlServer::FetchAssociative value should not be used when consuming a result set with multiple columns of the same name.
   *
   * @final
   * @see http://be2.php.net/manual/en/function.sqlsrv-fetch-array.php
   */
  const ScrollRelative = SQLSRV_SCROLL_RELATIVE;

  /**
   * Opens a connection to a Microsoft SQL Server database.
   * If values for the UID and PWD keys are not specified in $options, the connection will be attempted using Windows Authentication.
   *
   * @param array $options An associative array that specifies options for connecting to the server.
   * @link http://be2.php.net/manual/en/function.sqlsrv-connect.php
   * @link http://msdn.microsoft.com/en-us/library/ff628167.aspx
   */
  public function connect($options = null);

  /**
   * Prepares and executes a query.
   *
   * @param string $query The string that defines the query to be prepared and executed.
   * @param array $params An array specifying parameter information when executing a parameterized query.
   * @param array $options An array specifing query property options.
   * @return resource Returns a statement resource on success and FALSE if an error occurred.
   * @link http://be2.php.net/manual/en/function.sqlsrv-query.php
   */
  public function executeQuery($query, $params = null, $options = null);

  /**
   * @param resource $resource A statement resource returned by executeQuery() or execute().
   * @param int $type A predefined constant specifying the type of array to return.
   * @param int $row Specifies the row to access in a result set that uses a scrollable cursor.
   * @param int $offset No documentation found.
   * @return mixed Returns an array on success, NULL if there are no more rows to return, and FALSE if an error occurs.
   * @link http://be2.php.net/manual/en/function.sqlsrv-fetch-array.php
   */
  public function fetchArray($resource, $type = SqlServer::FetchBoth, $row = null, $offset = null);

  /**
   * Returns the number of rows modified by the last INSERT, UPDATE, or DELETE query executed.
   *
   * @return int Returns the number of rows affected by the last INSERT, UPDATE, or DELETE query. If no rows were affected, 0 is returned. If the number of affected rows cannot be determined, -1 is returned. If an error occured, FALSE is returned.
   * @link http://be2.php.net/manual/en/function.sqlsrv-rows-affected.php
   */
  public function getAffecteRows();

  /**
   * Returns error and warning information about the last SQLSRV operation performed.
   *
   * @return If errors and/or warnings occured on the last sqlsrv operation, and array of arrays containing error information is returned. If no errors and/or warnings occured on the last sqlsrv operation, NULL is returned.
   * @link http://be2.php.net/manual/en/function.sqlsrv-errors.php
   */
  public function getErrorMessage();

  /**
   * Defines if the driver is connected or not.
   *
   * @return boolean TRUE if driver is connected, FALSE otherwise.
   */
  public function isConnected();
}

?>
